#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalEntity.h"


class ShadowProcess : public RenderProcess
{
	DECLARE_PROCESS(ShadowProcess)

	struct Ubo
	{
		glm::mat4 mvp[3];
	};


protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

protected:

	uint32 mDim;



	std::vector<LocalEntity*> mModelEntitys;

	std::vector<LocalEntity*> mLightEntitys;



	RefCountPtr<RHIBuffer> mUboBuffer;

	RefCountPtr<RHIDescriptor> mDescriptor;

	std::vector<DescriptorMask> mDescriptorMasks;

	RefCountPtr<DepthRenderTarget> mShadowRenderTarget;

	RefCountPtr<RHISampler> mShadowSampler;

	RefCountPtr<GraphicsPipeline> mPipeline;

	RefCountPtr<RHIRenderPass> mRenderPass;

	RefCountPtr<RHIFrameBuffer> mFrameBuffer;





	RefCountPtr<RHICommandBuffer> mCommandBuffer;

	RefCountPtr<RHISemaphore> mWaitGraphicsSemaphore;

	RefCountPtr<RHISemaphore> mSignalOfflineSemaphore;
};
